import request from '@/config/axios'
import { getApiPath } from '@/config/api'

export function getDailyMeals({ date, userId }) {
  return request({
    url: getApiPath('MEAL_RECORDS'),
    method: 'get',
    params: {
      date,
      userId
    }
  })
}

export function addMealRecord(data) {
  return request({
    url: getApiPath('MEAL_RECORDS'),
    method: 'post',
    data: {
      ...data,
      userId: data.userId
    }
  })
}

export function updateMealRecord(id, data) {
  return request({
    url: `/meal-records/${id}`,
    method: 'put',
    data
  })
}

export function deleteMealRecord(id) {
  return request({
    url: `/meal-records/${id}`,
    method: 'delete'
  })
} 